package com.kxf.mvptest.model;

import com.kxf.mvptest.contract.LoginContract;
import com.kxf.mvptest.listeners.LoginListener;

/**
 * @ProjectName: AndroidTestDemo
 * @Package: com.kxf.mvptest.model
 * @ClassName: LoginModelImpl
 * @Description: java类作用描述
 * @Author: kuangxuefeng
 * @qq: 1024883177
 * @CreateDate: 2020/5/20 17:52
 */
public class LoginModelImpl implements LoginContract.Model {
    @Override
    public void login(final LoginListener listener) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                if (Math.random()>0.5){
                    listener.onSuccess();
                }else {
                    listener.onFail();
                }
            }
        }).start();
    }
}
